Skip to content

fix: dessin suit le curseur / stylet (S Pen Samsung)#6

Merged
TheZupZup merged 1 commit intomainfrom
claude/fix-gray-screen-I13Ww
Apr 11, 2026
Merged

fix: dessin suit le curseur / stylet (S Pen Samsung)#6
TheZupZup merged 1 commit intomainfrom
claude/fix-gray-screen-I13Ww

Conversation

@TheZupZup
Copy link
Copy Markdown
Owner

Problème

Le tracé dans le mode Draw ne suivait pas le curseur/stylet — les traits étaient décalés de ~52px vers le bas.

Cause

_toCanvasPos utilisait context.findRenderObject() qui retourne la RenderBox du widget InkCanvas entier, toolbar incluse (52px de hauteur). Toutes les coordonnées étaient donc décalées de la hauteur de la toolbar.

Fix

Utiliser e.localPosition directement depuis l'événement Listener, qui est déjà dans le système de coordonnées de la zone canvas (sous la toolbar). Plus besoin de chercher la RenderBox manuellement.

Améliorations bonus

  • Ajout de PointerDeviceKind.invertedStylus → le bout gomme du Samsung S Pen fonctionne maintenant
  • onPointerMove ignore les événements si aucun trait n'est en cours (évite des points parasites)

_toCanvasPos was using context.findRenderObject() which returns the
RenderBox of the entire InkCanvas widget including the toolbar (52px).
All drawn points were offset by the toolbar height, so strokes never
matched the cursor/stylus position.

Fix: use e.localPosition directly from the Listener event, which is
already in the canvas area coordinate space (below the toolbar).
Also:
- Add PointerDeviceKind.invertedStylus (Samsung S Pen eraser end)
- Guard onPointerMove to skip if no stroke is in progress

https://claude.ai/code/session_01DrMeeXsyuHucgvtcwtJoLN
@TheZupZup TheZupZup merged commit 9d22712 into main Apr 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant